package CodeTwo;

import java.util.Scanner;
import java.util.stream.IntStream;

/** @author ASUS */
public class Dicespin {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String str;
    str = scan.next();
    scan.close();
    int len;
    len = str.length();
    // 旋转前的序列
    int[] a = new int[6];
    // 旋转后的序列
    int[] b = new int[6];
    for (int i = 0; i < 6; i++) {
      // 初始化
      a[i] = i + 1;
    }

    for (int i = 0; i < len; i++) {
      if (str.charAt(i) == 'C') {
        b[0] = a[2];
        b[1] = a[3];
        b[2] = a[1];
        b[3] = a[0];
        b[4] = a[4];
        b[5] = a[5];
      } else if (str.charAt(i) == 'A') {
        b[0] = a[3];
        b[1] = a[2];
        b[2] = a[0];
        b[3] = a[1];
        b[4] = a[4];
        b[5] = a[5];
      } else if (str.charAt(i) == 'F') {
        b[0] = a[0];
        b[1] = a[1];
        b[2] = a[4];
        b[3] = a[5];
        b[4] = a[3];
        b[5] = a[2];
      } else if (str.charAt(i) == 'B') {
        b[0] = a[0];
        b[1] = a[1];
        b[2] = a[5];
        b[3] = a[4];
        b[4] = a[2];
        b[5] = a[3];
      } else if (str.charAt(i) == 'L') {
        b[0] = a[4];
        b[1] = a[5];
        b[2] = a[2];
        b[3] = a[3];
        b[4] = a[1];
        b[5] = a[0];
      } else if (str.charAt(i) == 'R') {
        b[0] = a[5];
        b[1] = a[4];
        b[2] = a[2];
        b[3] = a[3];
        b[4] = a[0];
        b[5] = a[1];
      }
      System.arraycopy(b, 0, a, 0, 6);
    }
    IntStream.range(0, 6).mapToObj(i -> b[i] + " ").forEachOrdered(System.out::print);
  }
}
